import Vue from "vue";
import Router from "vue-router";
import MyPage from "@/MyPage";
import Params from "@/Params";
import Menu from "@/Menu";
import Library from "@/LibraryPage";
import Index from "@/IndexPage";
import BooksInfo from "@/BooksInfo";
import Main from "@/MainPage";

// 使用router
Vue.use(Router);

// 创建router
export default new Router({
  base: "/",
  mode: "history",
  linkActiveClass: "active",
  routes: [
    {
      path: "/",
      component: Main,
      children: [
        {
          path: "",
          name: "Index",
          component: Index
        },
        {
          path: "library",
          name: "Library",
          component: Library
        },
        {
          path: "my",
          name: "My",
          component: MyPage
        }
      ]
    },
    {
      path: "/params/:id",
      name: "Params",
      component: Params
    },
    {
      path: "/books/:id",
      name: "BooksInfo",
      component: BooksInfo
    }
  ]
});
